import { Route, Routes } from 'react-router-dom'
import './App.css'
import MainLayout from './layout/index.jsx'
import Login from './views/Login/index.jsx'
import Product from './views/Product/index.jsx'
import DashBoard from './views/DashBoard/index.jsx'
import NotFound from './views/NotFound/index.jsx'
import RequireAuth from './guard/RequireAuth.jsx'
import Reg from './views/Reg/index.jsx'


// 函数式组件
function App() {

  return (
    <>
      <Routes>
        {/* 项目的第一层路由 */}
        <Route path='/' exact element={<RequireAuth><MainLayout/></RequireAuth>}>
          {/* 项目第二层路由 */}
          <Route path='/prod' element={<Product/>}/>
          <Route path='/dashboard' element={<DashBoard/>}/>
        </Route>
        <Route path='/login' element={<Login/>}></Route>
        <Route path='/reg' element={<Reg/>}></Route>
        <Route path='*' element={<NotFound/>}></Route>
      </Routes>
    </>
  )
}

export default App
